using System.Collections;

namespace Melody_Glider.MelodyContent
{
    public class Pitch
    {
        public const double R = 0;
        public const double C = 16.35;
        public const double Cs = 17.32;
        public const double D = 18.35;
        public const double Eb = 19.45;
        public const double E = 20.60;
        public const double F = 21.83;
        public const double Fs = 23.12;
        public const double G = 24.5;
        public const double Gs = 25.96;
        public const double A = 27.5;
        public const double Bb = 29.14;
        public const double B = 30.87;

        public static readonly Hashtable Symbols = new Hashtable
                                                     {
                                                         {"C", C}, {"C#", Cs}, {"D", D}, {"Eb", Eb},
                                                         {"E", E}, {"F", F}, {"F#", Fs}, {"G", G},
                                                         {"G#", Gs}, {"A", A}, {"Bb", Bb}, {"B", B},
                                                         {"Hb", Bb}, {"H", B}, {"R", R}
                                                     };
        
        public static readonly Hashtable PitchIndex = new Hashtable
                                                      {
                                                         {0, "C"}, {1, "D"}, {2, "E"}, {3, "F"}, {4, "G"},
                                                         {5, "A"}, {6, "B"}, 
                                                         {C, 0}, {Cs, 0}, {D, 1}, {Eb, 2}, {E, 2}, {F, 3}, {Fs, 3}, {G, 4}, {Gs, 4},
                                                         {A, 5}, {Bb, 6}, {B, 6}
                                                      };

        public readonly double Symbol;
        public readonly int OctaveShift; //-1: baseOctave-1, 0: baseOctave, 1: baseOctave+1

        public Pitch(double symbol, int octaveShift)
        {
            Symbol = symbol;
            OctaveShift = octaveShift;
        }
    }
}